Imports System.Data.OleDb
Imports DTO
Public Class ThamSoDAO
    Inherits AbstractDAO
    Public Sub New()

    End Sub
    Public Function LayBang() As DataTable
        Dim dt As New DataTable
        Dim cn As OleDbConnection
        cn = AbstractDAO.ConnectionData()
        Dim strSQL As String
        strSQL = "select * from ThamSo"
        Dim da As OleDbDataAdapter
        da = New OleDbDataAdapter(strSQL, cn)
        da.Fill(dt)
        cn.Close()
        Return dt
    End Function
    Public Function LayDanhSach() As IList
        Dim ds As New ArrayList
        Dim cn As OleDbConnection
        cn = AbstractDAO.ConnectionData()
        Dim strSQL As String
        strSQL = "select * from ThamSo"
        Dim cmb As New OleDbCommand(strSQL, cn)
        Dim dr As OleDbDataReader
        dr = cmb.ExecuteReader()
        While (dr.Read())
            Dim tsDto As New ThamSoDTO
            tsDto.MaThamSo = dr("MaThamSo")
            tsDto.MaThamSo = dr("TiLePhuThu")
        End While
        Return ds
    End Function
    Public Sub CapNhatBang(ByVal dt As DataTable)
        Dim cn As OleDbConnection
        cn = AbstractDAO.ConnectionData()
        Dim strSQL As String
        strSQL = "select * from ThamSo"
        Dim da As OleDbDataAdapter
        da = New OleDbDataAdapter(strSQL, cn)
        Dim cmb As New OleDbCommandBuilder(da)
        da.Update(dt)
        cn.Close()
    End Sub
    Public Sub SuaTiLePhuThu(ByVal dr As DataRow)
        Try
            Dim cn As OleDbConnection
            cn = AbstractDAO.ConnectionData()
            Dim strSQL As String
            strSQL = "update ThamSo set TiLePhuThu = ? where MaThamSo = 1"
            Dim cmb As New OleDbCommand(strSQL, cn)
            cmb.Parameters.Add("@TiLePhuThu", OleDbType.Integer)
            cmb.Parameters("@TiLePhuThu").Value = dr("TiLePhuThu")
            cmb.ExecuteNonQuery()
            cn.Close()
        Catch ex As Exception

        End Try
    End Sub
End Class
